<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html class="win-frame">
<head>
 <title>用户管理-查看用户</title>
 <%@include file="/common/head.jsp" %>
 <link href="<%=request.getContextPath()%>/static/plugin/zTree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet">
 <script src="<%=request.getContextPath()%>/static/plugin/zTree/js/jquery.ztree.all-3.5.min.js"></script>
</head>
<style type="text/css">
 .tree-title {
    border-bottom: 2px solid #fb9337;
    color: #666;
    font-size: 13px;
    font-weight: 600;
    margin: 0 15px 15px 0;
    padding: 0 40px 5px 5px;
    background-color: #ffffff;
 }
</style>
<body class="iframe-page">
<div class="page-title-wrapper">
    <div class="page-title">
        <div class="page-title-text">
            <span>用户管理</span>
            <span class="split"></span>
            <span>用户详情</span>
        </div>
        <a id="goBack" class="btn-return distance-left" href="javascript:;" onclick="parent.refreshList('${org.code}');"><i class="icon icon-arrow-left"></i>返回上级</a>
    </div>
    <div class="page-title-border"></div>
</div>

<form id="orgForm">
<div class="left-wrap">
   <h3>基本信息</h3>
    <table class="table-view">
        <tr>
	       <td class="td-title">登录名</td>
	       <td><span>${sysUser.username }</span></td>
        </tr>
        <tr>
	       <td class="td-title">姓名</td>
	       <td><span>${sysUser.realname }</span></td>
        </tr>
        <tr>
	       <td class="td-title">所属机构</td>
	       <td><span>${sysUser.orgName }</span></td>
        </tr>
        <tr>
	       <td class="td-title">分配角色</td>
	       <td><span>${empty sysUser.roleName ? '无' : sysUser.roleName}</span></td>
        </tr>
         <tr>
	       <td class="td-title">人员类型</td>
	       <td><span>${sysUser.type }</span></td>
        </tr>
        <tr>
	       <td class="td-title">用户状态</td>
	       <td><span>${sysUser.isUsable }</span></td>
        </tr>
        <tr>
	       <td class="td-title">性别</td>
	       <td><span>${sysUser.gender}</span></td>
        </tr>
        <tr>
	       <td class="td-title">电话</td>
	       <td><span>${sysUser.tel}</span></td>
        </tr>
        <tr>
	       <td class="td-title">手机</td>
	       <td><span>${sysUser.mobile}</span></td>
        </tr>
        <tr>
	       <td class="td-title">邮箱</td>
	       <td><span>${sysUser.email}</span></td>
        </tr>
        <tr>
	       <td class="td-title">职务</td>
	       <td><span>${sysUser.position}</span></td>
        </tr>
        <tr>
	       <td class="td-title">排序号</td>
	       <td><span>${sysUser.orderNo }</span></td>
        </tr>
    </table>
</div>   
<div class="right-wrap" id="right" style="display:none">   
       <h3>权限信息</h3>
       <ul id="resourceTree" class="ztree"></ul>
</div>  
</form>
<script>
    var ztree;
    $(function(){
    	//显示资源树
    	var resourceList = ${resourceList};
    	if (resourceList.length) {
    		initResourceTree();
    		$('#right').show();
    	}
    	
    	$('#goBack').on('click', backHome);
        
    });
    
    //初始化资源树
    function initResourceTree() {
        // ztree 初始化设置 
        var setting = {  
            data: {
                   simpleData: {
                       enable: true,
                       idKey: 'id',  // idkey
                       pIdKey: 'pId' // 父IDkey
                   },
                   key: {
                       url: 'zUrl' // url 字段名,解决字段名冲突问题
                   }
               }
        };
        var data = ${resourceList};
        ztree = $.fn.zTree.init($('#resourceTree'), setting, data); 
        expandNode();
    }
    
    // 展开树节点
    function expandNode() {
       var nodeId = '${param.expandId}',
           node;
       if (nodeId) {
           // 获取需要自动展开的节点
           node = ztree.getNodeByParam('id', nodeId, null);
       } else {
           // nodeId为空,展开根节点
           node = ztree.getNodeByParam('pId', null, null);
       }
       // 如果该节点不包含子节点,则展开其父节点
       if (node && !node.isParent) {
          node = node.getParentNode(); 
       }
       ztree.expandNode(node, true, false, true);
    }
  
    function backHome() {
      window.location.href = basePath + '/sys/user/init';
   }
</script>
</body>
</html>